package controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pojo.User;

import java.util.Date;

//请求控制
@RestController
//请求路径
@RequestMapping("/json")
public class JsonController {

    public String add(@RequestBody User user) {//json转换java对象
        System.out.println(user);
        return "成功";
    }

    @RequestMapping("/findAll")
    public User findAll() {
        User user = new User();
        user.setId(1);
        user.setUsername("wangwu");
        user.setBirthday(new Date());
        user.setSex("男");
        user.setMoney(5.0);
        return user;
    }
}
